home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj0987.arc / RESOLUT.C < prev    next >
Text File  |  1987-06-30  |  16KB  |  323 lines

  1. /*
  2.  * RESOLUT -- PC Tech Journal Laser Printer Resolution Test
  3.  *
  4.  * Version 1.0
  5.  *
  6.  * Copyright (c) 1987, Ziff Communications Company
  7.  * Program by: Rainer McCown and Bob Smith
  8.  *
  9.  * Prints a series of high-resolution patterns showing detailing
  10.  * capabilities of laser printers
  11.  */
  12.  
  13. #include "io.h"
  14.  
  15. #define MSIZ 64
  16.  
  17. char mat[][MSIZ+1] = {
  18. "0000000000000001000000000000000000000000000000001000000000000000",
  19. "0000000000000001100000000000000000000000000000011000000000000000",
  20. "0000000000000001110000000000000000000000000000111000000000000000",
  21. "0000000000000001111000000000000000000000000001111000000000000000",
  22. "0000000000000001111100000000000000000000000011111000000000000000",
  23. "0000000000000001111110000000000000000000000111111000000000000000",
  24. "0000000000000001111111000000000000000000001111111000000000000000",
  25. "0000000000000001111111100000000000000000011111111000000000000000",
  26. "0000000000000001111111110000000000000000111111111000000000000000",
  27. "1111111111111111111111111000000000000001111111111111111111111111",
  28. "1111111111111111111111111100000000000011111111111111111111111111",
  29. "1111111111111111111111111110000000000111111111111111111111111111",
  30. "1111111111111111111111111111000000001111111111111111111111111111",
  31. "1111111111111111111111111111100000011111111111111111111111111111",
  32. "1111111111111111111111111111110000111111111111111111111111111111",
  33. "1111111111111111111111111111111001111111111111111111111111111111",
  34. "1111111111111111111111111111111111111111111111111111111111111111",
  35. "1111111111111111111111111111111001111111111111111111111111111111",
  36. "1111111111111111111111111111110000111111111111111111111111111111",
  37. "1111111111111111111111111111100000011111111111111111111111111111",
  38. "1111111111111111111111111111000000001111111111111111111111111111",
  39. "1111111111111111111111111110000000000111111111111111111111111111",
  40. "1111111111111111111111111100000000000011111111111111111111111111",
  41. "1111111111111111111111111000000000000001111111111111111111111111",
  42. "0000000000000001111111110000000000000000111111111000000000000000",
  43. "0000000000000001111111100000000000000000011111111000000000000000",
  44. "0000000000000001111111000000000000000000001111111000000000000000",
  45. "0000000000000001111110000000000000000000000111111000000000000000",
  46. "0000000000000001111100000000000000000000000011111000000000000000",
  47. "0000000000000001111000000000000000000000000001111000000000000000",
  48. "0000000000000001110000000000000000000000000000111000000000000000",
  49. "0000000000000001100000000000000000000000000000011000000000000000",
  50. "0000000000000001000000000000000000000000000000001000000000000000",
  51. };
  52.  
  53. char mat1[][MSIZ+1] = {
  54. "0101010101010101010101010101010101010101010101010101010101010101",
  55. "0101010101010101010101010101010101010101010101010101010101010101",
  56. "0101010101010101010101010101010101010101010101010101010101010101",
  57. "0101010101010101010101010101010101010101010101010101010101010101",
  58. "0101010101010101010101010101010101010101010101010101010101010101",
  59. "0101010101010101010101010101010101010101010101010101010101010101",
  60. "0101010101010101010101010101010101010101010101010101010101010101",
  61. "0101010101010101010101010101010101010101010101010101010101010101",
  62. "0101010101010101010101010101010101010101010101010101010101010101",
  63. "0101010101010101010101010101010101010101010101010101010101010101",
  64. "0101010101010101010101010101010101010101010101010101010101010101",
  65. "0101010101010101010101010101010101010101010101010101010101010101",
  66. "0101010101010101010101010101010101010101010101010101010101010101",
  67. "0101010101010101010101010101010101010101010101010101010101010101",
  68. "0101010101010101010101010101010101010101010101010101010101010101",
  69. "0101010101010101010101010101010101010101010101010101010101010101",
  70. "0101010101010101010101010101010101010101010101010101010101010101",
  71. "0101010101010101010101010101010101010101010101010101010101010101",
  72. "0101010101010101010101010101010101010101010101010101010101010101",
  73. "0101010101010101010101010101010101010101010101010101010101010101",
  74. "0101010101010101010101010101010101010101010101010101010101010101",
  75. "0101010101010101010101010101010101010101010101010101010101010101",
  76. "0101010101010101010101010101010101010101010101010101010101010101",
  77. "0101010101010101010101010101010101010101010101010101010101010101",
  78. "0101010101010101010101010101010101010101010101010101010101010101",
  79. "0101010101010101010101010101010101010101010101010101010101010101",
  80. "0101010101010101010101010101010101010101010101010101010101010101",
  81. "0101010101010101010101010101010101010101010101010101010101010101",
  82. "0101010101010101010101010101010101010101010101010101010101010101",
  83. "0101010101010101010101010101010101010101010101010101010101010101",
  84. "0101010101010101010101010101010101010101010101010101010101010101",
  85. "0101010101010101010101010101010101010101010101010101010101010101",
  86. "0101010101010101010101010101010101010101010101010101010101010101",
  87. };
  88.  
  89. char mat2[][MSIZ+1] = {
  90. "1110111011101110111011101110111011101110111011101110111011101110",
  91. "1010101010101010101010101010101010101010101010101010101010101010",
  92. "1110111011101110111011101110111011101110111011101110111011101110",
  93. "0000000000000000000000000000000000000000000000000000000000000000",
  94. "1110111011101110111011101110111011101110111011101110111011101110",
  95. "1010101010101010101010101010101010101010101010101010101010101010",
  96. "1110111011101110111011101110111011101110111011101110111011101110",
  97. "0000000000000000000000000000000000000000000000000000000000000000",
  98. "1110111011101110111011101110111011101110111011101110111011101110",
  99. "1010101010101010101010101010101010101010101010101010101010101010",
  100. "1110111011101110111011101110111011101110111011101110111011101110",
  101. "0000000000000000000000000000000000000000000000000000000000000000",
  102. "1110111011101110111011101110111011101110111011101110111011101110",
  103. "1010101010101010101010101010101010101010101010101010101010101010",
  104. "1110111011101110111011101110111011101110111011101110111011101110",
  105. "0000000000000000000000000000000000000000000000000000000000000000",
  106. "1110111011101110111011101110111011101110111011101110111011101110",
  107. "1010101010101010101010101010101010101010101010101010101010101010",
  108. "1110111011101110111011101110111011101110111011101110111011101110",
  109. "0000000000000000000000000000000000000000000000000000000000000000",
  110. "1110111011101110111011101110111011101110111011101110111011101110",
  111. "1010101010101010101010101010101010101010101010101010101010101010",
  112. "1110111011101110111011101110111011101110111011101110111011101110",
  113. "0000000000000000000000000000000000000000000000000000000000000000",
  114. "1110111011101110111011101110111011101110111011101110111011101110",
  115. "1010101010101010101010101010101010101010101010101010101010101010",
  116. "1110111011101110111011101110111011101110111011101110111011101110",
  117. "0000000000000000000000000000000000000000000000000000000000000000",
  118. "1110111011101110111011101110111011101110111011101110111011101110",
  119. "1010101010101010101010101010101010101010101010101010101010101010",
  120. "1110111011101110111011101110111011101110111011101110111011101110",
  121. "0000000000000000000000000000000000000000000000000000000000000000",
  122. "1110111011101110111011101110111011101110111011101110111011101110",
  123. };
  124.  
  125. char mat3[][MSIZ+1] = {
  126. "1010101010101010101010101010101010101010101010101010101010101010",
  127. "0000000000000000000000000000000000000000000000000000000000000000",
  128. "1010101010101010101010101010101010101010101010101010101010101010",
  129. "0000000000000000000000000000000000000000000000000000000000000000",
  130. "1010101010101010101010101010101010101010101010101010101010101010",
  131. "0000000000000000000000000000000000000000000000000000000000000000",
  132. "1010101010101010101010101010101010101010101010101010101010101010",
  133. "0000000000000000000000000000000000000000000000000000000000000000",
  134. "1010101010101010101010101010101010101010101010101010101010101010",
  135. "0000000000000000000000000000000000000000000000000000000000000000",
  136. "1010101010101010101010101010101010101010101010101010101010101010",
  137. "0000000000000000000000000000000000000000000000000000000000000000",
  138. "1010101010101010101010101010101010101010101010101010101010101010",
  139. "0000000000000000000000000000000000000000000000000000000000000000",
  140. "1010101010101010101010101010101010101010101010101010101010101010",
  141. "0000000000000000000000000000000000000000000000000000000000000000",
  142. "1010101010101010101010101010101010101010101010101010101010101010",
  143. "0000000000000000000000000000000000000000000000000000000000000000",
  144. "1010101010101010101010101010101010101010101010101010101010101010",
  145. "0000000000000000000000000000000000000000000000000000000000000000",
  146. "1010101010101010101010101010101010101010101010101010101010101010",
  147. "0000000000000000000000000000000000000000000000000000000000000000",
  148. "1010101010101010101010101010101010101010101010101010101010101010",
  149. "0000000000000000000000000000000000000000000000000000000000000000",
  150. "1010101010101010101010101010101010101010101010101010101010101010",
  151. "0000000000000000000000000000000000000000000000000000000000000000",
  152. "1010101010101010101010101010101010101010101010101010101010101010",
  153. "0000000000000000000000000000000000000000000000000000000000000000",
  154. "1010101010101010101010101010101010101010101010101010101010101010",
  155. "0000000000000000000000000000000000000000000000000000000000000000",
  156. "1010101010101010101010101010101010101010101010101010101010101010",
  157. "0000000000000000000000000000000000000000000000000000000000000000",
  158. "1010101010101010101010101010101010101010101010101010101010101010",
  159. };
  160.  
  161.  
  162. char mat4[][MSIZ+1] = {
  163. "0000000000000000000000000000000000000000000000000000000000000000",
  164. "1111110001111100000011111000000000000000000000000000000000000000",
  165. "0001110010001110000100011100000000000000000000000000000000000000",
  166. "0001110100000011001000000110000000000000000000000000000000000000",
  167. "0001111000000011110000000111000000000000000000000000000000000000",
  168. "0001110000000011100000000111000000000000000000000000000000000000",
  169. "0001110000000011100000000111000000000000000000000000000000000000",
  170. "0001110000000011100000000111000000000000000000000000000000000000",
  171. "0001110000000011100000000111000000000000000000000000000000000000",
  172. "0001110000000011100000000111000000000000000000000000000000000000",
  173. "0001110000000011100000000111000000000000000000000000000000000000",
  174. "0001110000000011100000000111000000000000000000000000000000000000",
  175. "0001110000000011100000000111000000000000000000000000000000000000",
  176. "0001110000000011100000000111000000000000000000000000000000000000",
  177. "0001110000000011100000000111000000000000000000000000000000000000",
  178. "0001110000000011100000000111000000000000000000000000000000000000",
  179. "0001110000000011100000000111000000000000000000000000000000000000",
  180. "0001110000000011100000000111000000000000000000000000000000000000",
  181. "1111111110011111111100111111111000000000000000000000000000000000",
  182. "0000000000000000000000000000000000000000000000000000000000000000",
  183. "0000000000000000000000000000000000000000000000000000000000000000",
  184. "0000000000000000000000000000000000000000000000000000000000000000",
  185. "0000000000000000000000000000000000000000000000000000000000000000",
  186. "0000000000000000000000000000000000000000000000000000000000000000",
  187. "0000000000000000000000000000000000000000000000000000000000000000",
  188. "0000000000000000000000000000000000000000000000000000000000000000",
  189. "0000000000000000000000000000000000000000000000000000000000000000",
  190. "0000000000000000000000000000000000000000000000000000000000000000",
  191. "0000000000000000000000000000000000000000000000000000000000000000",
  192. "0000000000000000000000000000000000000000000000000000000000000000",
  193. "0000000000000000000000000000000000000000000000000000000000000000",
  194. "0000000000000000000000000000000000000000000000000000000000000000",
  195. "0000000000000000000000000000000000000000000000000000000000000000",
  196. };
  197.  
  198. char mat5[][MSIZ+1] = {
  199. "1111111111111111111111111111111111111111111111111111111111111111",
  200. "1111111111111111111111111111111111111111111111111111111111111111",
  201. "1111111111111111111111111111111111111111111111111111111111111111",
  202. "1111111111111111111111111111111111111111111111111111111111111111",
  203. "1111111111111111111111111111111111111111111111111111111111111111",
  204. "1111111111111111111111111111111111111111111111111111111111111111",
  205. "1111111111111111111111111111111111111111111111111111111111111111",
  206. "1111111111111111111111111111111111111111111111111111111111111111",
  207. "1111111111111111111111111111111111111111111111111111111111111111",
  208. "1111111111111111111111111111111111111111111111111111111111111111",
  209. "1111111111111111111111111111111111111111111111111111111111111111",
  210. "1111111111111111111111111111111111111111111111111111111111111111",
  211. "1111111111111111111111111111111111111111111111111111111111111111",
  212. "1111111111111111111111111111111111111111111111111111111111111111",
  213. "1111111111111111111111111111111111111111111111111111111111111111",
  214. "1111111111111111111111111111111111111111111111111111111111111111",
  215. "1111111111111111111111111111111111111111111111111111111111111111",
  216. "1111111111111111111111111111111111111111111111111111111111111111",
  217. "1111111111111111111111111111111111111111111111111111111111111111",
  218. "1111111111111111111111111111111111111111111111111111111111111111",
  219. "1111111111111111111111111111111111111111111111111111111111111111",
  220. "1111111111111111111111111111111111111111111111111111111111111111",
  221. "1111111111111111111111111111111111111111111111111111111111111111",
  222. "1111111111111111111111111111111111111111111111111111111111111111",
  223. "1111111111111111111111111111111111111111111111111111111111111111",
  224. "1111111111111111111111111111111111111111111111111111111111111111",
  225. "1111111111111111111111111111111111111111111111111111111111111111",
  226. "1111111111111111111111111111111111111111111111111111111111111111",
  227. "1111111111111111111111111111111111111111111111111111111111111111",
  228. "1111111111111111111111111111111111111111111111111111111111111111",
  229. "1111111111111111111111111111111111111111111111111111111111111111",
  230. "1111111111111111111111111111111111111111111111111111111111111111",
  231. "1111111111111111111111111111111111111111111111111111111111111111",
  232. };
  233.  
  234. struct PRT_LINE
  235.  {
  236.   char lhd[5];
  237.   char line[MSIZ/8];
  238.  };
  239.  
  240. struct PRT_LINE
  241.   prt_line = {'\x1B', '*', 'b', '0'+MSIZ/8, 'W'};
  242.  
  243. #define LINE_LEN sizeof(prt_line)
  244.  
  245. #define STD_OUT 1
  246.  
  247. extern void sndl(char [], int),
  248.         snd (char []),
  249.         setbinary(int);
  250.  
  251. /*************************** PMAT **********************************/
  252.  
  253. void pmat(mats)
  254.  
  255. char mats[][MSIZ+1];
  256.  
  257. {
  258.  int row, col, bit;
  259.  unsigned char byte;
  260.  
  261.  /* Send header info to printer */
  262.  
  263.  snd("\x1B*p+200x0100Y");       /* Position the output on the page */
  264.  snd("\x1B*r1A");               /* Start raster graphics mode */
  265.  
  266.  /* Translate MATS into bits for output to printer */
  267.  
  268.  for (row = 0; row < sizeof(mat)/sizeof(mat[0]); row++)
  269.     {
  270.      for (col = 0; col < MSIZ; col += 8)
  271.     {
  272.      for (byte = 0, bit = 0; bit < 8; bit++)
  273.           byte = (byte << 1) | (mats[row][col + bit] == '1');
  274.  
  275.      prt_line.line[col >> 3] = byte;
  276.     }
  277.  
  278.      /* Write out a line's worth */
  279.      sndl((char *) &prt_line, LINE_LEN);
  280.     }
  281.  
  282.  /* End raster graphics mode */
  283.  snd("\x1B*rB");
  284.  
  285. }
  286.  
  287. /******************************* MAIN *******************************/
  288.  
  289. void main()
  290.  
  291. {
  292.  int row, col, bit;
  293.  unsigned char byte;
  294.  
  295.  /* Change STD_OUT to binary mode to avoid
  296.     converting LFs to CR,LF and to avoid
  297.     stopping on EOFs
  298.   */
  299.  
  300.  setbinary(STD_OUT);
  301.  
  302.  /* Initialize the printer */
  303.  
  304.  snd("\x1BE");                  /* Reset the printer   */
  305.  snd("\x1B&l0O");               /* Portrait mode       */
  306.  snd("\x1B*t300R");             /* Set the printer resolution */
  307.  
  308.  /* Send the bit patterns to the printer */
  309.  
  310.  pmat(mat);
  311.  pmat(mat1);
  312.  pmat(mat2);
  313.  pmat(mat3);
  314.  pmat(mat4);
  315.  pmat(mat5);
  316.  
  317.  
  318.  /* Eject the paper */
  319.  snd("\f");
  320.  
  321. } /* End MAIN */
  322.  
  323.